How to keep replit flask project/url always active ASAP HELP NEEDED

Hey there!
I am trying to keep a flask project always active so that when i request the output text it wont say Internal Server Error. Maybe the Internal Server Error is another issue so plz help ASAP!

btw my url is: and the python program i made to get the info is:

query = input("Enter chat query")
url = ''
params = {'query': query}
response = requests.get(url, params=params)

for anyone who wants to help, Repl link is


The problem with your code is the formatting. Here’s the fixed code:

from flask import Flask, request
import g4f

app = Flask(__name__)

def index():
    return 'Hello from Flask!'

@app.route('/chat', methods=['GET'])
def chat():
  # Get parameters from the request URL
  query_message = request.args.get('query', '')
  # Using ChatCompletion for chat models
  response = g4f.ChatCompletion.create(
    messages=[{"role": "user", "content": query_message}],
  # Iterate over the response and send each message as part of the response
  result = ''.join(message for message in response)

  return f'{result}'

if __name__ == '__main__':'', port=81)
1 Like

what was the problem (spefics)

EDIT: Thanks yall for your help but i fixed it by publicly publishing the project!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.