Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import spaces
|
3 |
+
import torch
|
4 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
5 |
+
|
6 |
+
tokenizer = AutoTokenizer.from_pretrained("TIGER-Lab/MAmmoTH2-8B-Plus", trust_remote_code=True)
|
7 |
+
model = AutoModelForCausalLM.from_pretrained("TIGER-Lab/MAmmoTH2-8B-Plus", trust_remote_code=True)
|
8 |
+
|
9 |
+
def predict(input_text):
|
10 |
+
outputs = model.generate(input_text, max_length=50, do_sample=True)
|
11 |
+
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
12 |
+
|
13 |
+
demo = gr.Interface(fn=predict, inputs="text", outputs="text")
|
14 |
+
demo.launch()
|