Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
|
| 3 |
|
| 4 |
def main():
|
| 5 |
# Set up the page
|
|
@@ -19,21 +19,11 @@ def main():
|
|
| 19 |
# Input for user-provided data
|
| 20 |
prompt = st.text_area("Enter the prompt here:")
|
| 21 |
|
| 22 |
-
# Load model
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
# Button to generate the nudge
|
| 29 |
-
if st.button("Generate Nudge"):
|
| 30 |
-
if prompt.strip():
|
| 31 |
-
with st.spinner("Generating nudges..."):
|
| 32 |
-
response = pipe(messages)
|
| 33 |
-
st.success("Nudges generated successfully!")
|
| 34 |
-
st.text_area("Pipeline Response:", str(response), height=200)
|
| 35 |
-
else:
|
| 36 |
-
st.warning("Please enter data to generate nudges.")
|
| 37 |
|
| 38 |
if __name__ == "__main__":
|
| 39 |
main()
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
import gradio as gr
|
| 3 |
|
| 4 |
def main():
|
| 5 |
# Set up the page
|
|
|
|
| 19 |
# Input for user-provided data
|
| 20 |
prompt = st.text_area("Enter the prompt here:")
|
| 21 |
|
| 22 |
+
# Load model with Gradio
|
| 23 |
+
if st.button("Load and Launch Model"):
|
| 24 |
+
with st.spinner("Launching model..."):
|
| 25 |
+
gr.load("models/google/gemma-2-2b-it").launch()
|
| 26 |
+
st.success("Model launched successfully! Access it in the new tab opened by Gradio.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
if __name__ == "__main__":
|
| 29 |
main()
|