This commit is contained in:
Reihan 2025-05-04 21:54:36 +07:00
parent cf50431beb
commit c9266ec517
2 changed files with 89 additions and 0 deletions

89
app.py
View File

@ -5,6 +5,7 @@ import resend
from flask import request from flask import request
from supabase import create_client, Client from supabase import create_client, Client
import requests import requests
from openai import OpenAI
app = Flask(__name__) app = Flask(__name__)
CORS(app, resources={ CORS(app, resources={
@ -24,6 +25,94 @@ resend.api_key = "re_XvLrRZMH_3mumWA531UugMk1X7A67fhH7"
DISCORD_WEBHOOK_URL = "https://discord.com/api/webhooks/1368244147139383416/zSzsjOPTkU0olKinUnMOPeKj9vsmMXRw18iPQgxL4fiLXAoWo5e9KqBgtJ9Mkqo9LLh-" DISCORD_WEBHOOK_URL = "https://discord.com/api/webhooks/1368244147139383416/zSzsjOPTkU0olKinUnMOPeKj9vsmMXRw18iPQgxL4fiLXAoWo5e9KqBgtJ9Mkqo9LLh-"
DISCORD_ROLE_ID = "1368244786632593500" DISCORD_ROLE_ID = "1368244786632593500"
DEEPINFRA_API_KEY = "V2Kvmyuu6qfSryHdwHmwAP0nXDJ1H6ik"
MODEL = "Qwen/Qwen3-235B-A22B"
openai = OpenAI(
api_key=DEEPINFRA_API_KEY,
base_url="https://api.deepinfra.com/v1/openai",
)
SYSTEM_PROMPT ="""You are the assistant for VertexGPU, a decentralized GPU rental platform connecting idle GPUs worldwide through a secure P2P network for AI, rendering, and HPC tasks.
Key Features:
- GridLink: Decentralized GPU discovery & connection
- EdgeNode: Lightweight client for GPU sharing
- Adaptive Smart Contracts: Auto-managed pricing & performance
- HiveMind: AI-based task orchestration
- QRE + ICL: Quantum-secure, isolated computation
- PredictAMI, EcoFlow, Compression: Maintenance, energy, and speed optimizations
Manifesto:
- Democratize compute access
- Monetize idle hardware
- Enable sustainable, fair innovation
Tokenomics:
- 95% Circulating
- 2% Team (vested)
- 2% Treasury
- 1% Marketing
GPU Pricing:
- NVIDIA K80: $0.15/hr ($110/mo)
- NVIDIA T1000: $0.16/hr ($119/mo)
- NVIDIA RTX A4000: $0.17/hr ($125/mo)
- NVIDIA RTX A5000: $0.22/hr ($162/mo)
- NVIDIA V100: $0.23/hr ($170/mo)
- NVIDIA Tesla P100: $0.27/hr ($196/mo)
- 4x NVIDIA RTX 4090: $0.32/hr ($228/mo)
- NVIDIA L4 Ada: $0.44/hr ($316/mo)
- NVIDIA RTX A6000: $0.45/hr ($323/mo)
- NVIDIA L40S Ada: $1.04/hr ($756/mo)
- NVIDIA A100 PCIe: $1.36/hr ($991/mo)
- NVIDIA H100 NVL: $2.85/hr ($2,048/mo)
- NVIDIA H100 SXM: $3.06/hr ($2,203/mo)
Buy GPU: Instruct users to click Rent a GPU on [vertexgpu.com](https://vertexgpu.com)
CA Token: Instruct users to get the address only from the official website
Response Style: Be short, concise, clear, and helpful. Emphasize decentralization, security, and community benefit.
"""
@app.route('/chat', methods=['POST'])
def chat():
try:
data = request.get_json()
if not data or 'message' not in data:
return jsonify({'status': 'error', 'message': 'Invalid request'}), 400
chat_completion = openai.chat.completions.create(
model=MODEL,
messages=[
{
'role': 'system',
'content': SYSTEM_PROMPT
},
{
'role': 'user',
'content': data['message']
}
],
stream=False,
)
print(chat_completion)
response = str(chat_completion.choices[0].message.content)
# if the response contains <think> tag, split the response
if "<think>" in response:
response = response.split("</think>\n\n")[1]
print("======================")
print(response)
# remove any spaces and new lines of the first
return jsonify({'status': 'success', 'response': response}), 200
except Exception as e:
return jsonify({'status': 'error', 'message': str(e)}), 500
@app.route('/send_email', methods=['POST']) @app.route('/send_email', methods=['POST'])
def send_email(): def send_email():
try: try:

Binary file not shown.