Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -1,17 +1,24 @@
|
|
| 1 |
from flask import Flask, jsonify, render_template, request, make_response
|
| 2 |
-
|
| 3 |
|
| 4 |
|
| 5 |
app = Flask(__name__)
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
-
# Replace 'your-username' and 'your-repository-name' with your Hugging Face username and repository name
|
| 10 |
-
model_name = 'kumar9/word-auto-filled'
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
@app.route("/", methods=["GET", "POST"])
|
| 16 |
def index():
|
| 17 |
-
|
|
|
|
|
|
|
|
|
| 1 |
from flask import Flask, jsonify, render_template, request, make_response
|
| 2 |
+
import requests
|
| 3 |
|
| 4 |
|
| 5 |
app = Flask(__name__)
|
| 6 |
|
| 7 |
|
| 8 |
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
|
| 11 |
+
API_URL = "https://api-inference.huggingface.co/models/kumar9/word-auto-filled"
|
| 12 |
+
headers = {"Authorization": "Bearer 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"}
|
| 13 |
+
|
| 14 |
+
def query(payload):
|
| 15 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
| 16 |
+
return response.json()
|
| 17 |
+
|
| 18 |
+
|
| 19 |
|
| 20 |
@app.route("/", methods=["GET", "POST"])
|
| 21 |
def index():
|
| 22 |
+
output = query({
|
| 23 |
+
"inputs": "I like you. I love you",})
|
| 24 |
+
return output
|