Skip to content

Commit

Permalink
Merge pull request #2 from Luxadevi/Streamlit-merge
Browse files Browse the repository at this point in the history
Streamlit merge
  • Loading branch information
Luxadevi authored Dec 17, 2023
2 parents 9c59c5d + 576e5be commit 655c775
Show file tree
Hide file tree
Showing 34 changed files with 2,917 additions and 605 deletions.
File renamed without changes.
File renamed without changes.
68 changes: 34 additions & 34 deletions endpoint.py → Old Version/endpoint.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
from time import time
from flask import Flask, request, Response
import requests
from flask_cloudflared import run_with_cloudflared
import gradio as gr
from threading import Thread
import sys

app = Flask(__name__)

@app.route('/', defaults={'path': ''})
@app.route('/<path:path>', methods=['GET', 'POST', 'PUT', 'DELETE', 'PATCH'])
def proxy(path):
url = f'http://127.0.0.1:11434/{path}'
resp = requests.request(
method=request.method,
url=url,
headers={key: value for (key, value) in request.headers if key != 'Host'},
data=request.get_data(),
cookies=request.cookies,
allow_redirects=False)

excluded_headers = ['content-encoding', 'content-length', 'transfer-encoding', 'connection']
headers = [(name, value) for (name, value) in resp.raw.headers.items()
if name.lower() not in excluded_headers]
return Response(resp.content, resp.status_code, headers)
run_with_cloudflared(app)



if __name__ == '__main__':
app.run()
time.sleep(10)

from time import time
from flask import Flask, request, Response
import requests
from flask_cloudflared import run_with_cloudflared
import gradio as gr
from threading import Thread
import sys

app = Flask(__name__)

@app.route('/', defaults={'path': ''})
@app.route('/<path:path>', methods=['GET', 'POST', 'PUT', 'DELETE', 'PATCH'])
def proxy(path):
url = f'http://127.0.0.1:11434/{path}'
resp = requests.request(
method=request.method,
url=url,
headers={key: value for (key, value) in request.headers if key != 'Host'},
data=request.get_data(),
cookies=request.cookies,
allow_redirects=False)

excluded_headers = ['content-encoding', 'content-length', 'transfer-encoding', 'connection']
headers = [(name, value) for (name, value) in resp.raw.headers.items()
if name.lower() not in excluded_headers]
return Response(resp.content, resp.status_code, headers)
run_with_cloudflared(app)



if __name__ == '__main__':
app.run()
time.sleep(10)

sys.stdout.flush()
62 changes: 31 additions & 31 deletions endpointopenai.py → Old Version/endpointopenai.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
from time import time
from flask import Flask, request, Response
import requests
from flask_cloudflared import run_with_cloudflared
import gradio as gr
from threading import Thread
import sys

app = Flask(__name__)

@app.route('/', defaults={'path': ''})
@app.route('/<path:path>', methods=['GET', 'POST', 'PUT', 'DELETE', 'PATCH'])
def proxy(path):
url = f'http://127.0.0.1:8000/{path}'
resp = requests.request(
method=request.method,
url=url,
headers={key: value for (key, value) in request.headers if key != 'Host'},
data=request.get_data(),
cookies=request.cookies,
allow_redirects=False)

excluded_headers = ['content-encoding', 'content-length', 'transfer-encoding', 'connection']
headers = [(name, value) for (name, value) in resp.raw.headers.items()
if name.lower() not in excluded_headers]
return Response(resp.content, resp.status_code, headers)

run_with_cloudflared(app)

if __name__ == '__main__':
app.run(port=5001) # Specify the port as 5001
from time import time
from flask import Flask, request, Response
import requests
from flask_cloudflared import run_with_cloudflared
import gradio as gr
from threading import Thread
import sys

app = Flask(__name__)

@app.route('/', defaults={'path': ''})
@app.route('/<path:path>', methods=['GET', 'POST', 'PUT', 'DELETE', 'PATCH'])
def proxy(path):
url = f'http://127.0.0.1:8000/{path}'
resp = requests.request(
method=request.method,
url=url,
headers={key: value for (key, value) in request.headers if key != 'Host'},
data=request.get_data(),
cookies=request.cookies,
allow_redirects=False)

excluded_headers = ['content-encoding', 'content-length', 'transfer-encoding', 'connection']
headers = [(name, value) for (name, value) in resp.raw.headers.items()
if name.lower() not in excluded_headers]
return Response(resp.content, resp.status_code, headers)

run_with_cloudflared(app)

if __name__ == '__main__':
app.run(port=5001) # Specify the port as 5001
10 changes: 5 additions & 5 deletions installrequirements.txt → Old Version/installrequirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
gradio
requests
flask
flask-cloudflared
httpx
gradio
requests
flask
flask-cloudflared
httpx
litellm
Loading

0 comments on commit 655c775

Please sign in to comment.