Hadeel11 commited on
Commit
d084265
1 Parent(s): 2004231

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -1,19 +1,17 @@
1
  from transformers import AutoTokenizer, AutoModelForCausalLM, TextGenerationPipeline
2
- from gradio import Interface
3
 
4
  model_name = "Hadeel11/fine-tuned-model-2"
5
 
6
  tokenizer = AutoTokenizer.from_pretrained(model_name)
7
  model = AutoModelForCausalLM.from_pretrained(model_name)
8
 
9
-
10
- model.half()
11
-
12
  text_generator = TextGenerationPipeline(model=model, tokenizer=tokenizer)
13
 
14
  def generate_text(prompt):
15
  return text_generator(prompt, max_length=512, num_return_sequences=1)[0]['generated_text']
16
 
17
- iface = Interface(fn=generate_text, inputs="text", outputs="text", title="Text Generation Inference")
18
 
19
  iface.launch()
 
 
1
  from transformers import AutoTokenizer, AutoModelForCausalLM, TextGenerationPipeline
2
+ import gradio as gr
3
 
4
  model_name = "Hadeel11/fine-tuned-model-2"
5
 
6
  tokenizer = AutoTokenizer.from_pretrained(model_name)
7
  model = AutoModelForCausalLM.from_pretrained(model_name)
8
 
 
 
 
9
  text_generator = TextGenerationPipeline(model=model, tokenizer=tokenizer)
10
 
11
  def generate_text(prompt):
12
  return text_generator(prompt, max_length=512, num_return_sequences=1)[0]['generated_text']
13
 
14
+ iface = gr.Interface(fn=generate_text, inputs="text", outputs="text", title="Text Generation Inference")
15
 
16
  iface.launch()
17
+