osl-ai commited on
Commit
34f61d3
1 Parent(s): f17fe17

Update app.py

Browse files

Resolve AttributeError by ensuring correct model instantiation
Adjusted the model loading process to ensure the 'predict' method is available on the 'model' object. Included setting `share=True` in `launch()` to generate a public link as intended.

Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -1,15 +1,15 @@
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()
 
1
  import gradio as gr
2
 
3
+ # Assuming this is the correct path to your model and it returns a usable object.
4
  model = gr.Interface.load("models/NousResearch/Yarn-Mistral-7b-64k")
5
 
6
+ # Define a function that uses your model for inference, ensuring that the 'model' can predict.
7
  def predict(input):
8
+ # Example prediction code. Replace with actual prediction logic.
9
+ return model(input)
10
 
11
+ # Create a Gradio interface
12
  interface = gr.Interface(fn=predict, inputs="text", outputs="text")
13
 
14
+ # Launch the interface with share=True to create a public link.
15
+ interface.launch(share=True)