csuvikv commited on
Commit
8a554d7
1 Parent(s): 2f89b8c

initial commit

Browse files
Files changed (2) hide show
  1. app.py +31 -0
  2. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline, set_seed
3
+ from transformers import AutoModelForCausalLM, AutoTokenizer
4
+
5
+ checkpoint = "bigcode/starcoder-3b"
6
+ device = "cpu"
7
+
8
+
9
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
10
+ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
11
+
12
+
13
+
14
+
15
+ generator = pipeline('text-generation', model='gpt2', return_full_text=False)
16
+ set_seed(42)
17
+
18
+
19
+ def Bemenet(bemenet):
20
+ inputs = tokenizer.encode(bemenet, return_tensors="pt").to(device)
21
+ outputs = model.generate(inputs)
22
+ return tokenizer.decode(outputs[0])
23
+
24
+
25
+ interface = gr.Interface(fn=Bemenet,
26
+ title="Cím..",
27
+ description="Leírás..",
28
+ inputs="text",
29
+ outputs="text")
30
+
31
+ interface.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ transformers
2
+ tensorflow