enzer1992 commited on
Commit
40819c2
1 Parent(s): 5f81f2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -11
app.py CHANGED
@@ -1,14 +1,6 @@
1
- import gradio as gr
2
- from transformers import GPT2LMHeadModel, GPT2Tokenizer
3
 
4
- model_name = "enzer1992/AI-Guru"
5
  tokenizer = GPT2Tokenizer.from_pretrained(model_name)
6
- model = GPT2LMHeadModel.from_pretrained(model_name)
7
 
8
- def generate_text(prompt):
9
- inputs = tokenizer.encode(prompt, return_tensors="pt")
10
- outputs = model.generate(inputs, max_length=100, num_return_sequences=1)
11
- return tokenizer.decode(outputs[0], skip_special_tokens=True)
12
-
13
- interface = gr.Interface(fn=generate_text, inputs="text", outputs="text")
14
- interface.launch()
 
1
+ from transformers import TFGPT2LMHeadModel, GPT2Tokenizer
 
2
 
3
+ model_name = "gpt2"
4
  tokenizer = GPT2Tokenizer.from_pretrained(model_name)
5
+ model = TFGPT2LMHeadModel.from_pretrained(model_name)
6