Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support to send file as data to server using curl/request #7

Merged
merged 1 commit into from
Jun 1, 2023

Conversation

ayoubelmhamdi
Copy link

add support to send data like:

fileTMP="$1"
curl -s -F file=@"${fileTMP}" http://127.0.0.1:5500/
-@app.route('/')
+@app.route("/", methods=["GET", "POST"])
-async def index() -> None:
+async def index() -> str:
     """
     Main function
     """
     bot = EdgeGPT.Chatbot(proxy=args.proxy)

+    if request.method == "GET":
+        question = request.args.get("text")
+        print("get")
+    else:
+        file = request.files["file"]
+        text = file.read().decode("utf-8")
+        question = text
+        print("Post reading the file", question)

@aledipa aledipa merged commit a930a64 into aledipa:main Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants