Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ import gradio as gr
|
|
11 |
from PIL import Image
|
12 |
from datasets import load_dataset
|
13 |
from datasets import DownloadMode, VerificationMode
|
14 |
-
from diffusers import
|
15 |
|
16 |
from pingpong import PingPong
|
17 |
from pingpong.pingpong import PPManager
|
@@ -122,9 +122,15 @@ class GradioLLaMA2ChatPPManager(LLaMA2ChatPPManager):
|
|
122 |
TOKEN = os.getenv('HF_TOKEN')
|
123 |
MODEL_ID = 'meta-llama/Llama-2-70b-chat-hf'
|
124 |
|
125 |
-
pipe =
|
126 |
-
"
|
|
|
|
|
127 |
)
|
|
|
|
|
|
|
|
|
128 |
|
129 |
STYLES = """
|
130 |
.left-panel {
|
@@ -507,7 +513,7 @@ with gr.Blocks(css=STYLES) as demo:
|
|
507 |
"This application is designed for you to collaborate with LLM to co-write stories. It is inspired by [Wordcraft project](https://wordcraft-writers-workshop.appspot.com/) from Google's PAIR and Magenta teams. "
|
508 |
"This application built on [Gradio](https://www.gradio.app), and the underlying text generation is powered by [Hugging Face Inference API](https://huggingface.co/inference-api). The text generation model might"
|
509 |
"be changed over time, but [meta-llama/Llama-2-70b-chat-hf](https://huggingface.co/meta-llama/Llama-2-70b-chat-hf) is selected for now. On the `exporting` tab, you can generate cover art for your story. You can "
|
510 |
-
"design your own prompt to generate the cover art, or you can let the LLaMA2 to generate one for you. Currently,
|
511 |
"used.",
|
512 |
elem_classes=['center', 'small-big'])
|
513 |
|
@@ -574,7 +580,7 @@ with gr.Blocks(css=STYLES) as demo:
|
|
574 |
|
575 |
with gr.Tab("Exporting/Sharing"):
|
576 |
with gr.Column(elem_classes=['group-border']):
|
577 |
-
gr.Markdown("generate cover art with [`
|
578 |
"design your own prompt in the textbox below, or just hit 'generate prompt for cover art` button. LLaMA2 "
|
579 |
"model will suggest a prompt for you based on your story.")
|
580 |
|
|
|
11 |
from PIL import Image
|
12 |
from datasets import load_dataset
|
13 |
from datasets import DownloadMode, VerificationMode
|
14 |
+
from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
|
15 |
|
16 |
from pingpong import PingPong
|
17 |
from pingpong.pingpong import PPManager
|
|
|
122 |
TOKEN = os.getenv('HF_TOKEN')
|
123 |
MODEL_ID = 'meta-llama/Llama-2-70b-chat-hf'
|
124 |
|
125 |
+
pipe = DiffusionPipeline.from_pretrained(
|
126 |
+
"stabilityai/stable-diffusion-2-base",
|
127 |
+
torch_dtype=torch.float16,
|
128 |
+
revision="fp16"
|
129 |
)
|
130 |
+
pipe.scheduler = DPMSolverMultistepScheduler.from_config(
|
131 |
+
pipe.scheduler.config
|
132 |
+
)
|
133 |
+
pipe = pipe.to("cuda")
|
134 |
|
135 |
STYLES = """
|
136 |
.left-panel {
|
|
|
513 |
"This application is designed for you to collaborate with LLM to co-write stories. It is inspired by [Wordcraft project](https://wordcraft-writers-workshop.appspot.com/) from Google's PAIR and Magenta teams. "
|
514 |
"This application built on [Gradio](https://www.gradio.app), and the underlying text generation is powered by [Hugging Face Inference API](https://huggingface.co/inference-api). The text generation model might"
|
515 |
"be changed over time, but [meta-llama/Llama-2-70b-chat-hf](https://huggingface.co/meta-llama/Llama-2-70b-chat-hf) is selected for now. On the `exporting` tab, you can generate cover art for your story. You can "
|
516 |
+
"design your own prompt to generate the cover art, or you can let the LLaMA2 to generate one for you. Currently, Stable Diffusion 2.1 model `stabilityai/stable-diffusion-2-base` by [Stability AI](https://stability.ai/) is "
|
517 |
"used.",
|
518 |
elem_classes=['center', 'small-big'])
|
519 |
|
|
|
580 |
|
581 |
with gr.Tab("Exporting/Sharing"):
|
582 |
with gr.Column(elem_classes=['group-border']):
|
583 |
+
gr.Markdown("generate cover art with [`stabilityai/stable-diffusion-2-base`](https://huggingface.co/stabilityai/stable-diffusion-2-base) model. "
|
584 |
"design your own prompt in the textbox below, or just hit 'generate prompt for cover art` button. LLaMA2 "
|
585 |
"model will suggest a prompt for you based on your story.")
|
586 |
|