File size: 1,556 Bytes
ad21763
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25aff6c
2a3038f
e882144
ad21763
88570c9
ad21763
532fa3f
95d1712
 
 
 
 
 
161b7ff
ad21763
7772999
161b7ff
 
 
532fa3f
ad21763
 
 
 
 
 
 
 
b81ae68
ad21763
161b7ff
ad21763
161b7ff
355811f
 
 
 
 
 
 
 
 
 
 
 
 
 
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
"""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 gradio as gr
"""import transformers
from transformers import AutoTokenizer
import torch
from diffusers.utils.torch_utils import randn_tensor

model = "anirudh-sub/debate_model_v2.1"
tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = transformers.pipeline(
    "text-generation",
    model=model,
    torch_dtype=torch.float16,
    device_map="auto",
)


def debate_response(text):
    return "testing
    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:
        print(f"Result: {seq['generated_text']}")
        reponse += {seq['generated_text']}
    return resposnse

intf = gr.Interface(fn=debate_response, inputs=gr.Textbox(), outputs="text")
intf.launch()"""

# import gradio as gr

def greet(name):
    return "Hello " + name + "!"

demo = gr.Interface(
    fn=greet,
    inputs=gr.Textbox(lines=2, placeholder="Name Here..."),
    outputs="text",
)
if __name__ == "__main__":
    demo.launch()