File size: 647 Bytes
99689c5
0df52d4
c723f30
 
99689c5
2e23e90
0df52d4
528fe1a
0df52d4
b38d665
0df52d4
 
 
 
 
c723f30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import spaces, gradio as gr
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline


tokenizer = AutoTokenizer.from_pretrained("LingoIITGN/ganga-1b")
model = AutoModelForCausalLM.from_pretrained("LingoIITGN/ganga-1b")

@spaces.GPU(duration=120)
def greet(input_text):
    input_token = tokenizer.encode(input_text, return_tensors="pt")
    output = model.generate(input_token, max_new_tokens=100, num_return_sequences=1, do_sample=True, top_k=50, top_p=0.95, temperature=0.7)
    output_text = tokenizer.batch_decode(output)[0]
    return output_text

demo = gr.Interface(fn=greet, inputs=["text"], outputs=["text"],)
demo.launch()