Spaces:
aiqcamp
/
Running on Zero

aiqcamp commited on
Commit
0cdb73b
โ€ข
1 Parent(s): 1354a37

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -16
app.py CHANGED
@@ -6,8 +6,8 @@ import gradio as gr
6
  import torch
7
  import torchaudio
8
  import os
 
9
  from transformers import pipeline
10
- from pixabay import Image, Video
11
  import tempfile
12
 
13
  # ๊ธฐ๋ณธ ์„ค์ •
@@ -44,10 +44,7 @@ setup_eval_logging()
44
 
45
  # ๋ฒˆ์—ญ๊ธฐ ๋ฐ Pixabay API ์„ค์ •
46
  translator = pipeline("translation", model="Helsinki-NLP/opus-mt-ko-en")
47
-
48
-
49
-
50
- import requests
51
 
52
  def search_pixabay_videos(query, api_key):
53
  base_url = "https://pixabay.com/api/videos/"
@@ -63,15 +60,6 @@ def search_pixabay_videos(query, api_key):
63
  return [video['videos']['large']['url'] for video in data.get('hits', [])]
64
  return []
65
 
66
- # ๋ฉ”์ธ ์ฝ”๋“œ์—์„œ pixabay ๊ด€๋ จ ๋ถ€๋ถ„ ์ˆ˜์ •
67
- PIXABAY_API_KEY = "33492762-a28a596ec4f286f84cd328b17"
68
-
69
- def search_videos(query):
70
- query = translate_prompt(query)
71
- return search_pixabay_videos(query, PIXABAY_API_KEY)
72
-
73
-
74
-
75
  # CSS ์Šคํƒ€์ผ ์ •์˜
76
  custom_css = """
77
  .gradio-container {
@@ -150,8 +138,7 @@ def translate_prompt(text):
150
 
151
  def search_videos(query):
152
  query = translate_prompt(query)
153
- videos = pixabay_video.search(q=query, per_page=80)
154
- return [video.video_large for video in videos['hits']]
155
 
156
  @spaces.GPU
157
  @torch.inference_mode()
 
6
  import torch
7
  import torchaudio
8
  import os
9
+ import requests
10
  from transformers import pipeline
 
11
  import tempfile
12
 
13
  # ๊ธฐ๋ณธ ์„ค์ •
 
44
 
45
  # ๋ฒˆ์—ญ๊ธฐ ๋ฐ Pixabay API ์„ค์ •
46
  translator = pipeline("translation", model="Helsinki-NLP/opus-mt-ko-en")
47
+ PIXABAY_API_KEY = "33492762-a28a596ec4f286f84cd328b17"
 
 
 
48
 
49
  def search_pixabay_videos(query, api_key):
50
  base_url = "https://pixabay.com/api/videos/"
 
60
  return [video['videos']['large']['url'] for video in data.get('hits', [])]
61
  return []
62
 
 
 
 
 
 
 
 
 
 
63
  # CSS ์Šคํƒ€์ผ ์ •์˜
64
  custom_css = """
65
  .gradio-container {
 
138
 
139
  def search_videos(query):
140
  query = translate_prompt(query)
141
+ return search_pixabay_videos(query, PIXABAY_API_KEY)
 
142
 
143
  @spaces.GPU
144
  @torch.inference_mode()