Spaces:
Runtime error
Runtime error
Commit
·
3d2a0ba
1
Parent(s):
e9855cf
changing the gradio interface
Browse files
app.py
CHANGED
@@ -1,34 +1,39 @@
|
|
1 |
import gradio as gr
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
gr.Interface.load("tiiuae/falcon-40b").launch()
|
4 |
+
|
5 |
+
|
6 |
+
# import gradio as gr
|
7 |
+
|
8 |
+
# from transformers import AutoTokenizer, AutoModelForCausalLM
|
9 |
+
# import transformers
|
10 |
+
# import torch
|
11 |
+
|
12 |
+
|
13 |
+
# def falcon(input_text):
|
14 |
+
# model = "tiiuae/falcon-40b"
|
15 |
+
|
16 |
+
# tokenizer = AutoTokenizer.from_pretrained(model)
|
17 |
+
# pipeline = transformers.pipeline(
|
18 |
+
# "text-generation",
|
19 |
+
# model=model,
|
20 |
+
# tokenizer=tokenizer,
|
21 |
+
# torch_dtype=torch.bfloat16,
|
22 |
+
# trust_remote_code=True,
|
23 |
+
# device_map="auto",
|
24 |
+
# )
|
25 |
+
# sequences = pipeline(
|
26 |
+
# input_text, # "Was ist das höchste Gebäude in der Welt?"
|
27 |
+
# max_length=200,
|
28 |
+
# do_sample=True,
|
29 |
+
# top_k=10,
|
30 |
+
# num_return_sequences=1,
|
31 |
+
# eos_token_id=tokenizer.eos_token_id,
|
32 |
+
# )
|
33 |
+
# for seq in sequences:
|
34 |
+
# print(f"Result: {seq['generated_text']}")
|
35 |
+
|
36 |
+
# return sequences[0]['generated_text']
|
37 |
+
|
38 |
+
# iface = gr.Interface(fn=falcon, inputs="text", outputs="text")
|
39 |
+
# iface.launch() # To create a public link, set `share=True`
|