pixelpandacreative commited on
Commit
2f0fdb0
·
verified ·
1 Parent(s): b14b851

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import gradio as gr
2
  import pydicom
3
  import pandas as pd
@@ -5,9 +6,8 @@ from pathlib import Path
5
  from io import BytesIO
6
 
7
  def convert_dicom_to_tsv(dicom_file):
8
- dicom_file = pathlib.Path(__loader__).parent / "."
9
  # Read the DICOM file
10
- pydicom = dicom_data.dcmread(dicom_file)
11
 
12
  # Extract data elements from the DICOM file
13
  data_elements = {de.tag: (de.description(), de.value) for de in dicom_data}
@@ -24,11 +24,12 @@ def convert_dicom_to_tsv(dicom_file):
24
 
25
  # Create a Gradio interface
26
  app = gr.Interface(
27
- dicom_file = gr.File(type="df")
28
- b1 = gr.Button("Recognize Speech")
29
- b1.click(fn=convert_dicom_to_tsv, inputs=pydicom, outputs=file)
 
 
30
  )
31
-
32
 
33
  if __name__ == "__main__":
34
- app.launch(share=True)
 
1
+
2
  import gradio as gr
3
  import pydicom
4
  import pandas as pd
 
6
  from io import BytesIO
7
 
8
  def convert_dicom_to_tsv(dicom_file):
 
9
  # Read the DICOM file
10
+ dicom_data = pydicom.dcmread(dicom_file.name)
11
 
12
  # Extract data elements from the DICOM file
13
  data_elements = {de.tag: (de.description(), de.value) for de in dicom_data}
 
24
 
25
  # Create a Gradio interface
26
  app = gr.Interface(
27
+ fn=convert_dicom_to_tsv,
28
+ inputs=gr.File(label="Upload DICOM file"),
29
+ outputs=gr.File(label="Download TSV file"),
30
+ title="DICOM to TSV Converter",
31
+ description="Upload a DICOM file to convert it to TSV format."
32
  )
 
33
 
34
  if __name__ == "__main__":
35
+ app.launch(share=True)