Spaces:
Runtime error
Runtime error
Ibrahemqasim
commited on
Commit
•
0144135
1
Parent(s):
90e469d
Update app.py
Browse files
app.py
CHANGED
@@ -3,22 +3,11 @@ import torch
|
|
3 |
import os
|
4 |
from PIL import Image
|
5 |
|
6 |
-
Dir = os.path.dirname(os.path.abspath(__file__))
|
7 |
-
file = f"{Dir}/1.png"
|
8 |
-
if not os.path.isfile(file):
|
9 |
-
open(file, "wb").write(b"")
|
10 |
-
|
11 |
from transformers import AutoModelForCausalLM, AutoTokenizer, LocalAgent
|
12 |
|
13 |
checkpoint = "cerebras/Cerebras-GPT-1.3B"
|
14 |
agent = LocalAgent.from_pretrained(checkpoint, device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True)
|
15 |
|
16 |
-
def greet1(inp):
|
17 |
-
if inp:
|
18 |
-
u = agent.run("generate an image of `text` ", answer=inp)
|
19 |
-
u.save(file)
|
20 |
-
return Image.open(file)
|
21 |
-
|
22 |
def greet(inp):
|
23 |
if inp:
|
24 |
return agent.run("generate an image of `text` ", answer=inp)
|
|
|
3 |
import os
|
4 |
from PIL import Image
|
5 |
|
|
|
|
|
|
|
|
|
|
|
6 |
from transformers import AutoModelForCausalLM, AutoTokenizer, LocalAgent
|
7 |
|
8 |
checkpoint = "cerebras/Cerebras-GPT-1.3B"
|
9 |
agent = LocalAgent.from_pretrained(checkpoint, device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True)
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
def greet(inp):
|
12 |
if inp:
|
13 |
return agent.run("generate an image of `text` ", answer=inp)
|