File size: 1,091 Bytes
1274fe5
 
 
 
eafc150
 
1274fe5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95dcc7f
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import gradio as gr
import requests

# API URL-деріңіз
api_url_1 = "https://huggingface.co/spaces/Nurisslam/Lung_Disease_Classification/run/predict"
api_url_2 = "https://nurisslam-ai-dem.hf.space/run/predict"

# API-дан деректер алу функциясы
def call_api_1(input_data):
    response = requests.post(api_url_1, json={"data": input_data})
    return response.json()

def call_api_2(input_data):
    response = requests.post(api_url_2, json={"data": input_data})
    return response.json()

# API 1 үшін интерфейс
interface_1 = gr.Interface(
    fn=call_api_1, 
    inputs="text", 
    outputs="json", 
    title="API 1",
    description="Бұл бірінші API-ға сұрау жіберу"
)

# API 2 үшін интерфейс
interface_2 = gr.Interface(
    fn=call_api_2, 
    inputs="text", 
    outputs="json", 
    title="API 2",
    description="Бұл екінші API-ға сұрау жіберу"
)

# Екі интерфейсті бір уақытта іске қосу
interface_1.launch(share=True)
interface_2.launch(share=True)