takamarou commited on
Commit
786ad78
·
1 Parent(s): aba021f

debugging but need to pause server

Browse files
README.md CHANGED
@@ -7,6 +7,8 @@ sdk: gradio
7
  sdk_version: 4.26.0
8
  app_file: app.py
9
  pinned: false
 
 
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
7
  sdk_version: 4.26.0
8
  app_file: app.py
9
  pinned: false
10
+ preload_from_hub:
11
+ - stabilityai/stable-diffusion-3-medium
12
  ---
13
 
14
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py CHANGED
@@ -1,37 +1,10 @@
1
- import spaces
2
- import os
3
- import torch
4
- import gradio as gr
5
- from huggingface_hub import login
6
- from diffusers import StableDiffusion3Pipeline, DDPMScheduler
7
- from dotenv import load_dotenv
8
 
9
- load_dotenv()
10
- login(token=os.getenv("HF_TOKEN"))
 
 
 
11
 
12
- @spaces.GPU
13
- def generate():
14
- print('start generate')
15
- pipeline = StableDiffusion3Pipeline.from_pretrained(
16
- "stabilityai/stable-diffusion-3-medium",
17
- revision="refs/pr/26",
18
- torch_dtype=torch.float16,
19
- )
20
-
21
- pipeline.to("cuda")
22
- prompt = "A cat took a fish and running in a market"
23
- scheduler = DDPMScheduler(beta_start=0.00085, beta_end=0.012,
24
- beta_schedule="scaled_linear")
25
- return pipeline(
26
- prompt,
27
- scheduler=scheduler,
28
- num_inference_steps=30,
29
- guidance_scale=7.5,
30
- ).images
31
-
32
-
33
- gr.Interface(
34
- fn=generate,
35
- inputs=gr.Text(),
36
- outputs=gr.Gallery(),
37
- ).launch()
 
1
+ import subprocess
 
 
 
 
 
 
2
 
3
+ def start_unicorn():
4
+ command = [
5
+ 'gunicorn', 'hf-stickers.wsgi', '--bind', '0.0.0.0:7860'
6
+ ]
7
+ subprocess.run(command)
8
 
9
+ if __name__ == "__main__":
10
+ start_unicorn()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
hf-stickers/__pycache__/__init__.cpython-310.pyc CHANGED
Binary files a/hf-stickers/__pycache__/__init__.cpython-310.pyc and b/hf-stickers/__pycache__/__init__.cpython-310.pyc differ
 
hf-stickers/__pycache__/settings.cpython-310.pyc CHANGED
Binary files a/hf-stickers/__pycache__/settings.cpython-310.pyc and b/hf-stickers/__pycache__/settings.cpython-310.pyc differ
 
hf-stickers/__pycache__/wsgi.cpython-310.pyc CHANGED
Binary files a/hf-stickers/__pycache__/wsgi.cpython-310.pyc and b/hf-stickers/__pycache__/wsgi.cpython-310.pyc differ
 
webapp/__pycache__/__init__.cpython-310.pyc CHANGED
Binary files a/webapp/__pycache__/__init__.cpython-310.pyc and b/webapp/__pycache__/__init__.cpython-310.pyc differ
 
webapp/urls.py CHANGED
@@ -3,10 +3,5 @@ from django.urls import path
3
  from . import views
4
 
5
  urlpatterns = [
6
- path("", views.index, name="index"),
7
- path("generate-image", views.generate_image, name="generate_image"),
8
- path("improve-prompt", views.improve_prompt, name="improve_prompt"),
9
- path("get-random-prompt", views.get_random_prompt, name="get_random_prompt"),
10
- path("login", views.login, name="login"),
11
- path("oauth/callback", views.oauth_callback, name="oauth_callback"),
12
  ]
 
3
  from . import views
4
 
5
  urlpatterns = [
6
+ path("", views.index, name="index")
 
 
 
 
 
7
  ]
webapp/views.py CHANGED
@@ -1,6 +1,4 @@
1
  from django.http import HttpResponse
2
 
3
- logger = logging.getLogger('main')
4
-
5
  def index(request):
6
- return HttpResponse('Hello!', {}, request)
 
1
  from django.http import HttpResponse
2
 
 
 
3
  def index(request):
4
+ return HttpResponse('Hello!')