Spaces:
Runtime error
Runtime error
File size: 1,085 Bytes
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 |
"""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()"""
from transformers import AutoTokenizer
import transformers
import torch
model = "anirudh-sub/debate_model_practice"
def debate_response(text):
sequences = pipeline(
"How do I give a 1AR in debate in Lincoln Douglas Debate? \n",
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) |