Update app.py
Browse filesResolve 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.
app.py
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
#
|
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 |
-
#
|
9 |
-
return model
|
10 |
|
11 |
-
# Create a Gradio interface
|
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)
|