Spaces:
Runtime error
Runtime error
File size: 1,044 Bytes
ad21763 e882144 ad21763 e882144 ad21763 532fa3f ad21763 532fa3f ad21763 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
"""from fastai.vision.all import *
import gradio as gr
learn = load_learner('tokenizer.model')
categories = ('Rasam', 'Sambar')
def classify_image(img):
pred, idx, probs = learn.predict(img)
return dict(zip(categories, map(float, probs)))
image = gr.inputs.Image(shape=(192, 192))
label = gr.outputs.Label()
examples = ['sambar.jpg', 'rasam.jpg']
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
intf.launch()"""
import transformers
from transformers import AutoTokenizer
import torch
import gradio as gr
model = "anirudh-sub/debate_model_v2.1"
def debate_response(text):
sequences = pipeline(
text,
do_sample=True,
top_k=10,
num_return_sequences=1,
eos_token_id=tokenizer.eos_token_id,
max_length=500,
)
response = ""
for seq in sequences:
reponse += {seq['generated_text']}
return resposnse
text = gr.inputs.Text()
response = gr.outputs.Text()
intf = gr.Interface(fn=debate_response, inputs=text, outputs=response) |