Spaces:
Sleeping
Sleeping
Commit
·
af71772
1
Parent(s):
11f8d70
Added basic structure
Browse files- app.py +22 -2
- requirements.txt +1 -0
app.py
CHANGED
@@ -1,7 +1,27 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
2 |
|
3 |
def greet(name):
|
4 |
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
3 |
+
|
4 |
+
model = None
|
5 |
+
|
6 |
|
7 |
def greet(name):
|
8 |
return "Hello " + name + "!!"
|
9 |
|
10 |
+
|
11 |
+
def main():
|
12 |
+
|
13 |
+
print(f"Loading model...")
|
14 |
+
model_path = "meta-llama/Meta-Llama-3-8B"
|
15 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
16 |
+
model = AutoModelForCausalLM.from_pretrained(
|
17 |
+
model_path,
|
18 |
+
torch_dtype=torch.bfloat16,
|
19 |
+
device_map="auto",
|
20 |
+
)
|
21 |
+
|
22 |
+
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
23 |
+
demo.launch()
|
24 |
+
|
25 |
+
|
26 |
+
if __name__ == "__main__":
|
27 |
+
main()
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
transformers==4.34.0
|