Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import torch
|
| 3 |
+
from your_modelgpt_dev_file import BigramLanguageModel # Import your model class
|
| 4 |
+
|
| 5 |
+
# Load model
|
| 6 |
+
model = BigramLanguageModel()
|
| 7 |
+
model.load_state_dict(torch.load('transformer_weights.pth'))
|
| 8 |
+
model.eval()
|
| 9 |
+
|
| 10 |
+
def predict(input_text):
|
| 11 |
+
# Your preprocessing and prediction code
|
| 12 |
+
# output = model(input_text)
|
| 13 |
+
return "Predicted output" # Replace with actual prediction logic
|
| 14 |
+
|
| 15 |
+
interface = gr.Interface(fn=predict, inputs="text", outputs="text")
|
| 16 |
+
interface.launch()
|