Spaces:
Running
Running
Ifeanyi
commited on
Commit
•
1636073
1
Parent(s):
da037f1
promptGenerator files
Browse files- app.py +24 -0
- boy 2.jpeg +0 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
def PromptGenerator(prompt):
|
5 |
+
pipe = pipeline("text-generation", model="Gustavosta/MagicPrompt-Stable-Diffusion")
|
6 |
+
|
7 |
+
prompt = pipe(prompt)
|
8 |
+
|
9 |
+
prompt = prompt[0]
|
10 |
+
|
11 |
+
prompt = prompt["generated_text"]
|
12 |
+
|
13 |
+
return prompt
|
14 |
+
|
15 |
+
app = gr.Interface(PromptGenerator,
|
16 |
+
inputs = "text",
|
17 |
+
outputs = "text",
|
18 |
+
theme = gr.themes.Soft(primary_hue="blue",secondary_hue="stone"),
|
19 |
+
title = "AI Prompt Generator",
|
20 |
+
examples = ["Landscape of","Pixar style little girl","A racecar driving","Fireflies at night"],
|
21 |
+
css = ".gradio-container {background: url('file=/content/sample_data/boy 2.jpeg')}"
|
22 |
+
)
|
23 |
+
|
24 |
+
app.launch()
|
boy 2.jpeg
ADDED
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
xformers
|
3 |
+
gradio
|