LucaVivona commited on
Commit
c4929ba
Β·
1 Parent(s): f0c8838

frontend/require 🎨

Browse files
backend/requirements.txt CHANGED
@@ -33,7 +33,7 @@ kiwisolver==1.4.4
33
  linkify-it-py==1.0.3
34
  markdown-it-py==2.1.0
35
  MarkupSafe==2.1.1
36
- #matplotlib==3.5.2
37
  mdit-py-plugins==0.3.0
38
  mdurl==0.1.1
39
  monotonic==1.6
@@ -41,7 +41,7 @@ multidict==6.0.2
41
  numpy==1.23.1
42
  orjson==3.7.8
43
  packaging==21.3
44
- #pandas==1.4.3
45
  paramiko==2.11.0
46
  Pillow==9.2.0
47
  pycparser==2.21
 
33
  linkify-it-py==1.0.3
34
  markdown-it-py==2.1.0
35
  MarkupSafe==2.1.1
36
+ matplotlib==3.5.2
37
  mdit-py-plugins==0.3.0
38
  mdurl==0.1.1
39
  monotonic==1.6
 
41
  numpy==1.23.1
42
  orjson==3.7.8
43
  packaging==21.3
44
+ pandas==1.4.3
45
  paramiko==2.11.0
46
  Pillow==9.2.0
47
  pycparser==2.21
frontend/src/Components/Navagation/navbar.js CHANGED
@@ -174,7 +174,7 @@ export default class Navbar extends Component{
174
  return(<>
175
  <li key={`${item.name}-${item.port}`} onDragStart={(event) => this.onDragStart(event, 'custom', item, index)}
176
  className={` text-white text-md flex text-center items-center cursor-pointer shadow-lg
177
- p-7 px-2 mt-4 ${ this.state.open ? `hover:animate-pulse ${this.state.colour[index] === null ? "" : this.state.colour[index]} ` : `hidden`} rounded-md mt-2`} draggable>
178
  <span className="text-2xl font-medium "> </span>
179
  <span className={`text-base font-medium flex-1 text-left" ${this.state.open ? "" : "hidden"}`}>{`${this.state.emoji[index] === null ? "" : this.state.emoji[index]} ${item.name}`}</span>
180
  </li >
@@ -204,13 +204,13 @@ export default class Navbar extends Component{
204
  open={this.state.modal}
205
  size='small'
206
  >
207
- <Header icon>
208
  🌐
209
  <br/>
210
  Append Shared Gradio Hosts
211
  </Header>
212
  <Modal.Content>
213
- <div className=" text-center">Host other HugginFace Models or Gradio application via shared lin</div>
214
  <div className={`flex items-center rounded-md bg-light-white mt-6 border-dashed`}>
215
  <label className="relative block w-full">
216
  <span className={`absolute inset-y-0 left-0 flex items-center pl-3`}>
 
174
  return(<>
175
  <li key={`${item.name}-${item.port}`} onDragStart={(event) => this.onDragStart(event, 'custom', item, index)}
176
  className={` text-white text-md flex text-center items-center cursor-pointer shadow-lg
177
+ p-5 px-2 mt-4 ${ this.state.open ? `hover:animate-pulse ${this.state.colour[index] === null ? "" : this.state.colour[index]} ` : `hidden`} rounded-md mt-2 cursor-grabbing`} draggable>
178
  <span className="text-2xl font-medium "> </span>
179
  <span className={`text-base font-medium flex-1 text-left" ${this.state.open ? "" : "hidden"}`}>{`${this.state.emoji[index] === null ? "" : this.state.emoji[index]} ${item.name}`}</span>
180
  </li >
 
204
  open={this.state.modal}
205
  size='small'
206
  >
207
+ <Header className="select-none space-y-4" icon>
208
  🌐
209
  <br/>
210
  Append Shared Gradio Hosts
211
  </Header>
212
  <Modal.Content>
213
+ <div className=" text-center select-none">Host other HugginFace Models or Gradio application via shared lin</div>
214
  <div className={`flex items-center rounded-md bg-light-white mt-6 border-dashed`}>
215
  <label className="relative block w-full">
216
  <span className={`absolute inset-y-0 left-0 flex items-center pl-3`}>
frontend/src/Components/Nodes/{custom.js β†’ Custom.js} RENAMED
@@ -1,6 +1,6 @@
1
  import React from "react"
2
 
3
- export default class CustomNodeIframe extends React.Component {
4
  constructor({data}){
5
  super()
6
  this.myRef = React.createRef()
@@ -17,24 +17,41 @@ import React from "react"
17
  }).catch(()=>{
18
  this.setState({reachable : false, selected : !this.state.selected, data : this.state.data})
19
  })
20
- //>
 
 
 
 
 
 
 
 
 
 
21
 
22
  }
 
 
23
  render(){
24
 
25
- console.log(this.state.reachable)
26
  return (
27
  <>
28
  { this.state.selected && this.state.reachable ?
29
- <div className='relative h-[540px] w-[600px] overflow-hidden m-0 p-0' onClick={()=>this.handelSelected()}>
30
- <div className={`absolute h-full w-full ${this.state.data.colour} border-1shadow-2xl shadow-black rounded-xl -z-10`}></div>
31
- <iframe
 
 
 
 
 
32
  id="iframe"
33
  ref={this.myRef}
34
  src={this.state.data.host}
35
  title={this.state.data.label}
36
- frameBorder="0" class="container h-full p-2 flex-grow space-iframe overflow-scroll " allow="accelerometer; ambient-light-sensor; autoplay; battery; camera; document-domain; encrypted-media; fullscreen; geolocation; gyroscope; layout-animations; legacy-image-formats; magnetometer; microphone; midi; oversized-images; payment; picture-in-picture; publickey-credentials-get; sync-xhr; usb; vr ; wake-lock; xr-spatial-tracking" sandbox="allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads"></iframe>
37
- </div>:
 
38
  <>
39
  <div className='break-words'>
40
  <div className=' h-auto text-center pointer-events-none'>
 
1
  import React from "react"
2
 
3
+ export default class CustomNodeIframe extends React.Component {
4
  constructor({data}){
5
  super()
6
  this.myRef = React.createRef()
 
17
  }).catch(()=>{
18
  this.setState({reachable : false, selected : !this.state.selected, data : this.state.data})
19
  })
20
+ }
21
+
22
+ handelEvent = (e) => {
23
+ console.log(e.type)
24
+ if(e.type === "mousedown"){
25
+ console.log("down")
26
+ }
27
+ else {
28
+ console.log("up")
29
+ }
30
+
31
 
32
  }
33
+
34
+
35
  render(){
36
 
 
37
  return (
38
  <>
39
  { this.state.selected && this.state.reachable ?
40
+ <>
41
+ <div className="w-full h-10 top-0 hover:bg-black" onClick={this.handelEvent} onMouseDown={this.handelEvent} onMouseUp={this.handelEvent}>
42
+
43
+ </div>
44
+
45
+ <div className='relative h-[540px] w-[600px] overflow-hidden m-0 p-0 shadow-2xl' onClick={()=>this.handelSelected()}>
46
+ <div className={`absolute h-full w-full ${this.state.data.colour} border-1shadow-2xl shadow-black rounded-xl -z-20`}></div>
47
+ <iframe
48
  id="iframe"
49
  ref={this.myRef}
50
  src={this.state.data.host}
51
  title={this.state.data.label}
52
+ frameBorder="0" className=" -z-10 container h-full p-2 flex-grow space-iframe overflow-scroll " allow="accelerometer; ambient-light-sensor; autoplay; battery; camera; document-domain; encrypted-media; fullscreen; geolocation; gyroscope; layout-animations; legacy-image-formats; magnetometer; microphone; midi; oversized-images; payment; picture-in-picture; publickey-credentials-get; sync-xhr; usb; vr ; wake-lock; xr-spatial-tracking" sandbox="allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads"></iframe>
53
+ </div>
54
+ </> :
55
  <>
56
  <div className='break-words'>
57
  <div className=' h-auto text-center pointer-events-none'>
frontend/src/Components/ReactFlow/ReactFlowEnv.js CHANGED
@@ -1,4 +1,4 @@
1
- import CustomNodeIframe from "../Nodes/custom";
2
  import '../../css/dist/output.css'
3
  import '../../css/CustomNode.css'
4
  import ReactFlow, { Background,
@@ -7,7 +7,7 @@ import ReactFlow, { Background,
7
  ReactFlowProvider,
8
  } from 'react-flow-renderer';
9
  import React ,{ useState, useCallback, useRef } from 'react';
10
- import Navbar from '../Navagation/Navbar';
11
  import { useThemeDetector } from '../../helper/visual'
12
 
13
  const types = {
@@ -16,12 +16,12 @@ const types = {
16
 
17
  export default function ReactEnviorment() {
18
 
19
- const [theme, setTheme] = useState(useThemeDetector)
20
  const [nodes, setNodes] = useState([]);
21
  const [edges, setEdges] = useState([]);
22
  const [reactFlowInstance, setReactFlowInstance] = useState(null);
23
  const reactFlowWrapper = useRef(null);
24
-
25
 
26
  const onNodesChange = useCallback(
27
  (changes) => setNodes((nds) => applyNodeChanges(changes, nds)),
@@ -71,10 +71,10 @@ export default function ReactEnviorment() {
71
 
72
  return (
73
  <>
74
- <div className=' absolute top-4 right-5 z-50' onClick={()=> setTheme(theme === "" ? "dark" : "")}>
75
- <h1 className='text-4xl' >{theme === "dark" ? 'πŸŒ™' : 'β˜€οΈ'}</h1>
76
  </div>
77
- <div className={`flex h-screen w-screen ${theme} transition-all`}>
78
  <Navbar/>
79
  <ReactFlowProvider>
80
  <div className="h-screen w-screen" ref={reactFlowWrapper}>
 
1
+ import CustomNodeIframe from "../Nodes/Custom.js";
2
  import '../../css/dist/output.css'
3
  import '../../css/CustomNode.css'
4
  import ReactFlow, { Background,
 
7
  ReactFlowProvider,
8
  } from 'react-flow-renderer';
9
  import React ,{ useState, useCallback, useRef } from 'react';
10
+ import Navbar from '../Navagation/navbar';
11
  import { useThemeDetector } from '../../helper/visual'
12
 
13
  const types = {
 
16
 
17
  export default function ReactEnviorment() {
18
 
19
+ const [theme, setTheme] = useState(useThemeDetector())
20
  const [nodes, setNodes] = useState([]);
21
  const [edges, setEdges] = useState([]);
22
  const [reactFlowInstance, setReactFlowInstance] = useState(null);
23
  const reactFlowWrapper = useRef(null);
24
+ console.log("theme",theme)
25
 
26
  const onNodesChange = useCallback(
27
  (changes) => setNodes((nds) => applyNodeChanges(changes, nds)),
 
71
 
72
  return (
73
  <>
74
+ <div className=' absolute top-4 right-5 z-50' onClick={()=> setTheme(theme ? "dark" : "")}>
75
+ <h1 className='text-4xl select-none' >{theme ? 'πŸŒ™' : 'β˜€οΈ'}</h1>
76
  </div>
77
+ <div className={`flex h-screen w-screen ${theme ? "dark" : ""} transition-all`}>
78
  <Navbar/>
79
  <ReactFlowProvider>
80
  <div className="h-screen w-screen" ref={reactFlowWrapper}>
frontend/src/css/dist/output.css CHANGED
@@ -628,6 +628,10 @@ video {
628
  right: 1.25rem;
629
  }
630
 
 
 
 
 
631
  .z-10 {
632
  z-index: 10;
633
  }
@@ -636,10 +640,22 @@ video {
636
  z-index: -10;
637
  }
638
 
 
 
 
 
639
  .z-50 {
640
  z-index: 50;
641
  }
642
 
 
 
 
 
 
 
 
 
643
  .float-left {
644
  float: left;
645
  }
@@ -712,6 +728,10 @@ video {
712
  height: 100%;
713
  }
714
 
 
 
 
 
715
  .w-10 {
716
  width: 2.5rem;
717
  }
@@ -750,10 +770,33 @@ video {
750
  cursor: pointer;
751
  }
752
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
753
  .items-center {
754
  align-items: center;
755
  }
756
 
 
 
 
 
 
 
757
  .overflow-auto {
758
  overflow: auto;
759
  }
@@ -822,6 +865,11 @@ video {
822
  background-color: rgba(255,255,255, 0.18);
823
  }
824
 
 
 
 
 
 
825
  .bg-gradient-to-bl {
826
  background-image: linear-gradient(to bottom left, var(--tw-gradient-stops));
827
  }
@@ -1167,6 +1215,11 @@ video {
1167
  border-color: rgb(151 0 204 / var(--tw-border-opacity));
1168
  }
1169
 
 
 
 
 
 
1170
  .focus\:border-sky-500:focus {
1171
  --tw-border-opacity: 1;
1172
  border-color: rgb(14 165 233 / var(--tw-border-opacity));
 
628
  right: 1.25rem;
629
  }
630
 
631
+ .top-0 {
632
+ top: 0px;
633
+ }
634
+
635
  .z-10 {
636
  z-index: 10;
637
  }
 
640
  z-index: -10;
641
  }
642
 
643
+ .-z-0 {
644
+ z-index: 0;
645
+ }
646
+
647
  .z-50 {
648
  z-index: 50;
649
  }
650
 
651
+ .-z-20 {
652
+ z-index: -20;
653
+ }
654
+
655
+ .z-0 {
656
+ z-index: 0;
657
+ }
658
+
659
  .float-left {
660
  float: left;
661
  }
 
728
  height: 100%;
729
  }
730
 
731
+ .h-5 {
732
+ height: 1.25rem;
733
+ }
734
+
735
  .w-10 {
736
  width: 2.5rem;
737
  }
 
770
  cursor: pointer;
771
  }
772
 
773
+ .cursor-s-resize {
774
+ cursor: s-resize;
775
+ }
776
+
777
+ .cursor-grab {
778
+ cursor: grab;
779
+ }
780
+
781
+ .cursor-grabbing {
782
+ cursor: grabbing;
783
+ }
784
+
785
+ .select-none {
786
+ -webkit-user-select: none;
787
+ user-select: none;
788
+ }
789
+
790
  .items-center {
791
  align-items: center;
792
  }
793
 
794
+ .space-y-4 > :not([hidden]) ~ :not([hidden]) {
795
+ --tw-space-y-reverse: 0;
796
+ margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));
797
+ margin-bottom: calc(1rem * var(--tw-space-y-reverse));
798
+ }
799
+
800
  .overflow-auto {
801
  overflow: auto;
802
  }
 
865
  background-color: rgba(255,255,255, 0.18);
866
  }
867
 
868
+ .bg-black {
869
+ --tw-bg-opacity: 1;
870
+ background-color: rgb(0 0 0 / var(--tw-bg-opacity));
871
+ }
872
+
873
  .bg-gradient-to-bl {
874
  background-image: linear-gradient(to bottom left, var(--tw-gradient-stops));
875
  }
 
1215
  border-color: rgb(151 0 204 / var(--tw-border-opacity));
1216
  }
1217
 
1218
+ .hover\:bg-black:hover {
1219
+ --tw-bg-opacity: 1;
1220
+ background-color: rgb(0 0 0 / var(--tw-bg-opacity));
1221
+ }
1222
+
1223
  .focus\:border-sky-500:focus {
1224
  --tw-border-opacity: 1;
1225
  border-color: rgb(14 165 233 / var(--tw-border-opacity));