Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,29 +1,22 @@
|
|
1 |
-
import streamlit as st
|
2 |
import gradio as gr
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
st.set_page_config(page_title="Nudge Generator - Gemma 2b", page_icon="orYx logo.png", layout="wide")
|
7 |
-
|
8 |
-
# Title and logo
|
9 |
-
col1, col2 = st.columns([3, 1])
|
10 |
-
with col1:
|
11 |
-
st.title("Nudge Generator - Gemma 2b")
|
12 |
-
with col2:
|
13 |
-
st.image("orYx logo.png", use_column_width=True)
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
-
|
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()
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
# Load the model
|
4 |
+
model_interface = gr.load("models/google/gemma-2-2b-it")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
+
# Create a Gradio interface with custom title and logo
|
7 |
+
def main():
|
8 |
+
with gr.Blocks() as demo:
|
9 |
+
# Add the title
|
10 |
+
gr.Markdown("# Gemma 2b Demo")
|
11 |
+
|
12 |
+
# Add the logo
|
13 |
+
gr.Image("orYx logo.png", elem_id="logo", show_label=False, interactive=False)
|
14 |
+
|
15 |
+
# Embed the model interface inside a Row
|
16 |
+
with gr.Row():
|
17 |
+
model_interface.render() # Use render to include the prebuilt interface
|
18 |
|
19 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
20 |
|
21 |
if __name__ == "__main__":
|
22 |
+
main()
|