seawolf2357 commited on
Commit
8893195
Β·
verified Β·
1 Parent(s): 8af719d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -26,17 +26,14 @@ def translate_prompt(prompt):
26
  logging.debug(f'λ²ˆμ—­λœ ν…μŠ€νŠΈ: {translated_text}')
27
  return translated_text
28
 
29
- # 이미지 생성 및 응닡 처리 ν•¨μˆ˜
30
  def generate_image(prompt, negative_prompt):
31
  headers = {
32
  "Authorization": f"Bearer {os.getenv('HF_TOKEN')}"
33
  }
 
 
34
  data = {
35
- "inputs": {
36
- "prompt": prompt,
37
- "negative_prompt": negative_prompt,
38
- "num_inference_steps": 50
39
- }
40
  }
41
  api_url = "https://api-inference.huggingface.co/models/fluently/Fluently-XL-Final"
42
  response = requests.post(api_url, headers=headers, json=data)
@@ -47,6 +44,7 @@ def generate_image(prompt, negative_prompt):
47
  logging.error(f"API μš”μ²­μ— μ‹€νŒ¨ν–ˆμŠ΅λ‹ˆλ‹€: {response.text}")
48
  return None
49
 
 
50
  class MyClient(discord.Client):
51
  async def on_ready(self):
52
  logging.info(f'{self.user}둜 λ‘œκ·ΈμΈλ˜μ—ˆμŠ΅λ‹ˆλ‹€!')
 
26
  logging.debug(f'λ²ˆμ—­λœ ν…μŠ€νŠΈ: {translated_text}')
27
  return translated_text
28
 
 
29
  def generate_image(prompt, negative_prompt):
30
  headers = {
31
  "Authorization": f"Bearer {os.getenv('HF_TOKEN')}"
32
  }
33
+ # ν”„λ‘¬ν”„νŠΈμ™€ λ„€κ±°ν‹°λΈŒ ν”„λ‘¬ν”„νŠΈλ₯Ό κ²°ν•©ν•˜μ—¬ ν•˜λ‚˜μ˜ λ¬Έμžμ—΄λ‘œ 처리
34
+ combined_prompt = f"{prompt}. {negative_prompt}"
35
  data = {
36
+ "inputs": combined_prompt
 
 
 
 
37
  }
38
  api_url = "https://api-inference.huggingface.co/models/fluently/Fluently-XL-Final"
39
  response = requests.post(api_url, headers=headers, json=data)
 
44
  logging.error(f"API μš”μ²­μ— μ‹€νŒ¨ν–ˆμŠ΅λ‹ˆλ‹€: {response.text}")
45
  return None
46
 
47
+
48
  class MyClient(discord.Client):
49
  async def on_ready(self):
50
  logging.info(f'{self.user}둜 λ‘œκ·ΈμΈλ˜μ—ˆμŠ΅λ‹ˆλ‹€!')