-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
2,441 additions
and
605 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
10
installrequirements.txt → Old Version/installrequirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.