File size: 984 Bytes
41f3e59
 
 
 
 
3bf2eb9
41f3e59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
39
import gradio as gr
from gradio_client import Client
import os

api_key = os.environ["TOM"]
client = Client("Zelyanoth/Linkedin_poster",hf_token = api_key)


# --- Tes fonctions existantes que tu vas brancher ici
def ajouter_rss(rss_link):
    result = client.predict(
		rss_link=rss_link,
		api_name="/ajouter_rss"
)
    return f"RSS ajouté : {rss_link}"


# --- Interface Gradio
def interface():
    with gr.Blocks() as app:
        gr.Markdown("## 🚀 Mon App : Ajouter un RSS")

        with gr.Row():
            rss_input = gr.Textbox(label="Lien RSS", placeholder="Entrez un lien RSS ici...")
        
        with gr.Row():
            bouton_add_rss = gr.Button("➕ Ajouter RSS")

        # Affichage du résultat
        output = gr.Textbox(label="Résultat")

        # Associer les boutons aux fonctions
        bouton_add_rss.click(fn=ajouter_rss, inputs=[rss_input], outputs=[output])

    return app

if __name__ == "__main__":
    app = interface()
    app.launch()