osl-ai commited on
Commit
f17fe17
·
1 Parent(s): 5f82275

Update app.py

Browse files

Fix Attribute-error on model loading and interface launch
Resolved an issue where calling 'launch()' on a 'Dependency' object raised an AttributeError by correctly creating a Gradio interface after model loading. The model is now properly wrapped within the Gradio interface before calling 'launch()'.

Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -1,3 +1,15 @@
1
  import gradio as gr
2
 
3
- gr.Interface.load("models/NousResearch/Yarn-Mistral-7b-64k").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ # Load your model (replace 'models/NousResearch/Yarn-Mistral-7b-64k' with your actual model path)
4
+ model = gr.Interface.load("models/NousResearch/Yarn-Mistral-7b-64k")
5
+
6
+ # Define a function that uses your model for inference
7
+ def predict(input):
8
+ # Your prediction code here
9
+ return model.predict(input)
10
+
11
+ # Create a Gradio interface that uses the `predict` function
12
+ interface = gr.Interface(fn=predict, inputs="text", outputs="text")
13
+
14
+ # Launch the interface
15
+ interface.launch()