acecalisto3 commited on
Commit
cf2c535
1 Parent(s): 82769ca

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import requests
3
+
4
+ # Define the base URL for the Blackbox API
5
+ base_url = "https://api.kastg.xyz/api/ai/blackbox"
6
+
7
+ # Define the function to make the API request
8
+ def make_request(prompt):
9
+ # Define the query parameters for the API request
10
+ params = {
11
+ "prompt": prompt,
12
+ "web_search": False
13
+ }
14
+
15
+ # Make a GET request to the Blackbox API with the query parameters
16
+ response = requests.get(base_url, params=params)
17
+
18
+ # Check the status code of the response
19
+ if response.status_code == 200:
20
+ # If the request was successful, return the response data
21
+ return response.json()
22
+ else:
23
+ # If the request was not successful, return an error message
24
+ return f"Error: {response.status_code}"
25
+
26
+ # Define the Gradio interface
27
+ iface = gr.Interface(fn=make_request, inputs="text", outputs="text")
28
+
29
+ # Launch the interface
30
+ iface.launch()