Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 2 |
+
# import transformers
|
| 3 |
+
# import torch
|
| 4 |
+
# import gradio as gr
|
| 5 |
+
|
| 6 |
+
# model = "tiiuae/falcon-7b-instruct"
|
| 7 |
+
|
| 8 |
+
# tokenizer = AutoTokenizer.from_pretrained(model)
|
| 9 |
+
# pipeline = transformers.pipeline(
|
| 10 |
+
# "text-generation",
|
| 11 |
+
# model=model,
|
| 12 |
+
# tokenizer=tokenizer,
|
| 13 |
+
# torch_dtype=torch.bfloat16,
|
| 14 |
+
# trust_remote_code=True,
|
| 15 |
+
# device_map="auto",
|
| 16 |
+
# )
|
| 17 |
+
# sequences = pipeline(
|
| 18 |
+
# "Girafatron is obsessed with giraffes, the most glorious animal on the face of this Earth. Giraftron believes all other animals are irrelevant when compared to the glorious majesty of the giraffe.\nDaniel: Hello, Girafatron!\nGirafatron:",
|
| 19 |
+
# max_length=200,
|
| 20 |
+
# do_sample=True,
|
| 21 |
+
# top_k=10,
|
| 22 |
+
# num_return_sequences=1,
|
| 23 |
+
# eos_token_id=tokenizer.eos_token_id,
|
| 24 |
+
# )
|
| 25 |
+
# def predict(image):
|
| 26 |
+
# predictions = pipeline(image)
|
| 27 |
+
# return {seq['generated_text'] for seq in sequences}
|
| 28 |
+
|
| 29 |
+
# gr.Interface(
|
| 30 |
+
# predict,
|
| 31 |
+
# inputs=gr.inputs.Image(label="Ask Enything", type="filepath"),
|
| 32 |
+
# outputs=gr.outputs.Label(num_top_classes=2),
|
| 33 |
+
# title="Hot Dog? Or Not?",
|
| 34 |
+
# ).launch()
|
| 35 |
+
import gradio as gr
|
| 36 |
+
|
| 37 |
+
gr.Interface.load("tiiuae/falcon-7b-instruct").launch()
|