joanhightech commited on
Commit
004fdbb
·
verified ·
1 Parent(s): 6c3e6e1

JM: try to get output into file

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -1,10 +1,14 @@
1
  import gradio as gr
 
2
 
3
  def salut(nom):
4
- with open('data.txt', 'w') as file:
 
 
 
5
  file.write(f"Nom: {nom}\n")
6
-
7
- return "Salut " + nom
8
 
9
  demo = gr.Interface(fn=salut, inputs="text", outputs="text")
10
  demo.launch(share=True)
 
1
  import gradio as gr
2
+ import subprocess
3
 
4
  def salut(nom):
5
+ with open("data.txt", "w") as file:
6
+ p = subprocess.run(["pwd"], capture_output=True)
7
+ file.write(str(p.stdout))
8
+ print(str(p.stdout))
9
  file.write(f"Nom: {nom}\n")
10
+
11
+ return "Salut " + nom
12
 
13
  demo = gr.Interface(fn=salut, inputs="text", outputs="text")
14
  demo.launch(share=True)