Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,24 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
# Load the model
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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("#
|
| 11 |
|
| 12 |
# Add the logo
|
| 13 |
gr.Image("orYx logo.png", elem_id="logo", show_label=False, interactive=False)
|
|
@@ -19,4 +30,4 @@ def main():
|
|
| 19 |
demo.launch()
|
| 20 |
|
| 21 |
if __name__ == "__main__":
|
| 22 |
-
main()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
# Load the model from Hugging Face
|
| 4 |
+
def load_model():
|
| 5 |
+
try:
|
| 6 |
+
model_interface = gr.load("huggingface/TinyLlama/TinyLlama-1.1B-Chat-v1.0")
|
| 7 |
+
return model_interface
|
| 8 |
+
except ValueError as e:
|
| 9 |
+
print(f"Error loading the model: {e}")
|
| 10 |
+
return None
|
| 11 |
|
| 12 |
# Create a Gradio interface with custom title and logo
|
| 13 |
def main():
|
| 14 |
+
model_interface = load_model()
|
| 15 |
+
if model_interface is None:
|
| 16 |
+
print("Failed to load the model. Exiting.")
|
| 17 |
+
return
|
| 18 |
+
|
| 19 |
with gr.Blocks() as demo:
|
| 20 |
# Add the title
|
| 21 |
+
gr.Markdown("# TinyLlama Demo")
|
| 22 |
|
| 23 |
# Add the logo
|
| 24 |
gr.Image("orYx logo.png", elem_id="logo", show_label=False, interactive=False)
|
|
|
|
| 30 |
demo.launch()
|
| 31 |
|
| 32 |
if __name__ == "__main__":
|
| 33 |
+
main()
|