Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
def face_projection(text):
|
| 5 |
+
processed_text = preprocess_text(text)
|
| 6 |
+
|
| 7 |
+
face_image = generate_face_image(processed_text)
|
| 8 |
+
|
| 9 |
+
return face_image
|
| 10 |
+
|
| 11 |
+
def preprocess_text(text):
|
| 12 |
+
return text
|
| 13 |
+
|
| 14 |
+
def generate_face_image(processed_text):
|
| 15 |
+
face_projection_pipeline = pipeline("text2image", model="Purz/face-projection")
|
| 16 |
+
|
| 17 |
+
face_image = face_projection_pipeline(processed_text)
|
| 18 |
+
|
| 19 |
+
return face_image
|
| 20 |
+
|
| 21 |
+
iface = gr.Interface(
|
| 22 |
+
fn=face_projection,
|
| 23 |
+
inputs="text",
|
| 24 |
+
outputs="image",
|
| 25 |
+
title="Face Projection from Text"
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
iface.launch()
|