DIVY118 commited on
Commit
27c7f8a
·
verified ·
1 Parent(s): 9c0a721

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py CHANGED
@@ -5,6 +5,7 @@ from news import News
5
  from datetime import datetime
6
  from os import listdir
7
  from web import Online_Scraper
 
8
 
9
  app = Flask(__name__)
10
 
@@ -77,6 +78,26 @@ def Web():
77
  }
78
  return jsonify(result)
79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
  @app.route('/divyanshpizza', methods=['GET'])
82
  def get_counters():
 
5
  from datetime import datetime
6
  from os import listdir
7
  from web import Online_Scraper
8
+ import requests
9
 
10
  app = Flask(__name__)
11
 
 
78
  }
79
  return jsonify(result)
80
 
81
+ @app.route('/imageneration', methods=['POST'])
82
+ def IMGEN():
83
+ data = request.json
84
+ prompt = data.get('prompt', '')
85
+ key = data.get('key', '')
86
+
87
+ API_URL = "https://api-inference.huggingface.co/models/OEvortex/HelpingAI-PixelCraft"
88
+ headers = {"Authorization": f"Bearer {key}"}
89
+
90
+ def query(payload):
91
+ response = requests.post(API_URL, headers=headers, json=payload)
92
+ return response.content
93
+
94
+
95
+ result = {
96
+ 'response': query({"inputs": prompt,})
97
+ }
98
+
99
+ return jsonify(result)
100
+
101
 
102
  @app.route('/divyanshpizza', methods=['GET'])
103
  def get_counters():