Update app.py
Browse files
app.py
CHANGED
@@ -5,30 +5,6 @@ import transformers
|
|
5 |
import torch
|
6 |
|
7 |
|
8 |
-
def falcon(input_text):
|
9 |
-
model = "tiiuae/falcon-40b"
|
10 |
|
11 |
-
tokenizer = AutoTokenizer.from_pretrained(model)
|
12 |
-
pipeline = transformers.pipeline(
|
13 |
-
"text-generation",
|
14 |
-
model=model,
|
15 |
-
tokenizer=tokenizer,
|
16 |
-
torch_dtype=torch.bfloat16,
|
17 |
-
trust_remote_code=True,
|
18 |
-
device_map="auto",
|
19 |
-
)
|
20 |
-
sequences = pipeline(
|
21 |
-
input_text, # "你吃饭了吗?"
|
22 |
-
max_length=200,
|
23 |
-
do_sample=True,
|
24 |
-
top_k=10,
|
25 |
-
num_return_sequences=1,
|
26 |
-
eos_token_id=tokenizer.eos_token_id,
|
27 |
-
)
|
28 |
-
for seq in sequences:
|
29 |
-
print(f"Result: {seq['generated_text']}")
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
iface = gr.Interface(fn=falcon, inputs="text", outputs="text")
|
34 |
-
iface.launch() # To create a public link, set `share=True`
|
|
|
5 |
import torch
|
6 |
|
7 |
|
|
|
|
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
+
gr.Interface.load("models/radames/stable-diffusion-v1-5-img2img").launch()
|
|
|
|
|
|